# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Matt Harrison <matt@harrison.us.com>
# Contributor: Erik van der Kolk <developer at smerik dot nl>
# Contributor: Hong Xu

pkgname=editorconfig-core-c
pkgver=0.12.6
pkgrel=1
pkgdesc='EditorConfig core code written in C (for use by plugins supporting EditorConfig parsing)'
arch=(x86_64)
url='https://github.com/editorconfig/editorconfig-core-c'
license=(BSD)
depends=(pcre2)
makedepends=(cmake doxygen)
source=(https://github.com/editorconfig/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('36052a5371731d915b53d9c7a24a11c4032585ccacb392ec9d58656eef4c0edf')

build() {
  cmake -B build -S $pkgname-$pkgver \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
